home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / c_toolbx.arc / DOMERGE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-30  |  603 b   |  22 lines

  1. /*  domerge.c - merge parts of external sort */
  2. #include   "stdio.h"
  3. #include   "merge1.h"
  4.  
  5.  
  6. int  domerge(scra,scrb,tofile,nruns)
  7.   char    scra[] ;        /* input scratch files on 1st pass */
  8.   char    scrb[] ;        /* output scratch files on 1st pass */
  9.   char    tofile[] ;        /* put final output here */
  10.   int    nruns ;         /* number of runs on 1st pass */
  11.   {
  12.      while( nruns > 1 )
  13.     {  if( nruns <= MAX_MERGE )
  14.           strcpy(scrb,tofile) ;    /* last pass - output to file */
  15.        nruns = dopass(scra,scrb,nruns) ; /* do merge pass */
  16.        swap_str(scra,scrb) ;    /* swap input and output */
  17.     }
  18.   }
  19.  
  20.  
  21.  
  22.